import { Component } from "react";
import {
  Button,
  Cell,
  Empty,
  Avatar,
  Grid,
  Image,
  Tabs,
  Table,
} from "@nutui/nutui-react-taro";
import styles from "./index.scss";
import { useModel } from "@/store";
import Taro from "@tarojs/taro";
import { useState } from "react";
import { queryExamList } from "@/services/report";
import { useEffect } from "react";
import { formatDate, calculateTime } from "@/utils/repeated";
import ListView from "@/components/ListView";
import TimeRangePicker from "@/components/TimeRangePicker";
// import { IconFont } from "@nutui/icons-react-taro";
export default () => {
  const { user, getUser } = useModel("user");
  const { curPatientInfo } = useModel("patient");
  const [timeRange, setTimeRange] = useState({
    startDate: calculateTime(-30),
    endDate: calculateTime(7),
  });
  return (
    <view className={styles.examList}>
      <ListView
        getList={queryExamList}
        params={{
          // queryNo: "01802601",
          queryNo: curPatientInfo.patientId,
          applyStartDate: timeRange.startDate,
          applyEndDate: timeRange.endDate,
          pageSize: "10",
          //   pageNo: "1",
        }}
        topRender={
          <TimeRangePicker
            timeRangeChange={(e) => {
              setTimeRange(e);
            }}
          ></TimeRangePicker>
        }
        row={(item, index) => (
          <view
            className={styles.inspectCard}
            key={item.testAppointNo}
            onClick={() => {
              Taro.navigateTo({
                url: `/pages/report/examReport/index?examAppointNo=${item.examAppointNo}&itemNo=${item.itemNo}`,
              });
            }}
          >
            <view className={styles.title}>{item.examItemName}</view>
            <view className={styles.text}>开单科室:{item.visitDept}</view>
            <view className={styles.text}>申请日期:{item.applyDate}</view>
          </view>
        )}
      ></ListView>
    </view>
  );
};